From: Andy Holmes Date: Thu, 21 May 2020 19:24:14 +0000 (-0700) Subject: StClipboard: add st_clipboard_get_mimetypes X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~684^2^2~365 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=669b0f193a184b77d4ffcf93d5008e994cb0f7b5;p=gnome-shell.git StClipboard: add st_clipboard_get_mimetypes Since the `MetaSelection` of the global `StClipboard` is private (and should be), there is no reasonable way for extensions or external code to query the supported mime-types. Add `st_clipboard_get_mimetypes()` so this can be queried without poking around in private code. closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2819 --- diff --git a/src/st/st-clipboard.c b/src/st/st-clipboard.c index 1dcd1e75f..52ad4941c 100644 --- a/src/st/st-clipboard.c +++ b/src/st/st-clipboard.c @@ -146,6 +146,29 @@ transfer_cb (MetaSelection *selection, g_free (text); } +/** + * st_clipboard_get_mimetypes: + * @clipboard: a #StClipboard + * + * Gets a list of the mimetypes supported by the default #StClipboard. + * + * Returns: (element-type utf8) (transfer full): the supported mimetypes + */ +GList * +st_clipboard_get_mimetypes (StClipboard *clipboard, + StClipboardType type) +{ + MetaSelectionType selection_type; + + g_return_val_if_fail (ST_IS_CLIPBOARD (clipboard), NULL); + g_return_val_if_fail (meta_selection != NULL, NULL); + + if (!convert_type (type, &selection_type)) + return NULL; + + return meta_selection_get_mimetypes (meta_selection, selection_type); +} + /** * st_clipboard_get_text: * @clipboard: A #StCliboard diff --git a/src/st/st-clipboard.h b/src/st/st-clipboard.h index 60e384601..22ef63f7f 100644 --- a/src/st/st-clipboard.h +++ b/src/st/st-clipboard.h @@ -65,6 +65,9 @@ typedef void (*StClipboardCallbackFunc) (StClipboard *clipboard, StClipboard* st_clipboard_get_default (void); +GList * st_clipboard_get_mimetypes (StClipboard *clipboard, + StClipboardType type); + void st_clipboard_get_text (StClipboard *clipboard, StClipboardType type, StClipboardCallbackFunc callback,